package com.j2ee.JDKProxy.multi.interfaces;

import java.lang.reflect.Proxy;

import org.junit.Test;

public class AAndBImplTest {
	
	@Test
	public void testMultiInterfaces() {
		Object target = new AAndBImpl() ;
		Logger logger = new Logger() ;
		AAndBImplInterceptor interceptor = new AAndBImplInterceptor(target, logger);
		
		//代理类实现A接口
		A proxyA = (A) Proxy.newProxyInstance(target.getClass().getClassLoader(),
				target.getClass().getInterfaces(), interceptor) ;
		proxyA.aa() ;
		
		//代理类实现B接口
		B proxyB = (B) Proxy.newProxyInstance(target.getClass().getClassLoader(),
				target.getClass().getInterfaces(), interceptor) ;
		proxyB.bb() ;
	}

}
